package com.qf;

import com.qf.utils.MD5Utils;
import org.junit.Test;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;
import java.util.Random;

public class test {
    @Test
    public void test01(){
//        Random random = new Random();
//        int i = random.nextInt();
//        System.err.println(i);
//        i = random.nextInt();
//        System.err.println(i);
        Random random = new Random(212454556463L);
        System.err.println(random.nextInt());

        Random random1 = new Random(212454556463L);
        System.err.println(random1.nextInt());


    }
    @Test
    public void test02(){
        char[] zifu={'a','b','c','d','e','f','g'};
        StringBuffer stringBuffer = new StringBuffer();
        Random random = new Random();
        for (int i = 20; i >0; i--) {
            int index = random.nextInt(7);
            stringBuffer.append(zifu[index]);
        }
        System.out.println(stringBuffer.toString());//ccbgebgbbcfeddddeabf
    }
    @Test
    public void test03() {
        String randomString = MD5Utils.getRandomString(15);//BcHEZZsZnaColBw
        System.err.println(randomString);
        String pwd = "123456";
        System.err.println(MD5Utils.getMd5(pwd, randomString, 2));//f196cbaccf9e79f150ca66e316a843ae
    }
    @Test
    public void test04() {
        System.err.println(MD5Utils.sum(5));
    }
    //591b047e47e30fc1d17205eec66d882a
    @Test
    public void test05() {
        String s = DigestUtils.md5DigestAsHex("BcHEZZsZnaColBw123456BcHEZZsZnaColBw".getBytes(StandardCharsets.UTF_8));
        System.err.println(DigestUtils.md5DigestAsHex(("BcHEZZsZnaColBw" + s + "BcHEZZsZnaColBw").getBytes(StandardCharsets.UTF_8)));
        System.err.println(MD5Utils.getMd5("123456", "BcHEZZsZnaColBw", 2));
    }
}
